package com.liuxin.zhiyuan.shujuzhongxin.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.liuxin.zhiyuan.shujuzhongxin.domain.po.MajorCategoryEntity;
import com.liuxin.zhiyuan.shujuzhongxin.service.MajorCategoryService;
import com.liuxin.common.utils.PageUtils;
import com.liuxin.common.utils.R;



/**
 * 专业类信息表
 *
 * @author zsl
 * @email 1301966496@qq.com
 * @date 2025-10-14 23:09:01
 */
@RestController
@RequestMapping("shujuzhongxin/majorcategory")
public class MajorCategoryController {
    @Autowired
    private MajorCategoryService majorCategoryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("shujuzhongxin:majorcategory:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = majorCategoryService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    //@RequiresPermissions("shujuzhongxin:majorcategory:info")
    public R info(@RequestParam("id") Integer id){
		MajorCategoryEntity majorCategory = majorCategoryService.getById(id);

        return R.ok().put("majorCategory", majorCategory);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("shujuzhongxin:majorcategory:save")
    public R save(@RequestBody MajorCategoryEntity majorCategory){
		majorCategoryService.save(majorCategory);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   //@RequiresPermissions("shujuzhongxin:majorcategory:update")
    public R update(@RequestBody MajorCategoryEntity majorCategory){
		majorCategoryService.updateById(majorCategory);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("shujuzhongxin:majorcategory:delete")
    public R delete(@RequestBody Integer[] ids){
		majorCategoryService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
